﻿using AutoMapper;
using BTL.OnlineTestingSocial.Domain.TestingEngine;

namespace BTL.OnlineTestingSocial.Application.Web.Infrastructure.ViewModels.ViewModelMapper
{
    public class AutoMapperConfiguration
    {
        public static void Configure()
        {
            Mapper.CreateMap<Comment, CommentViewModel>()
                .ForMember(x => x.Id, o => o.MapFrom(m => m.Id))
                .ForMember(x => x.Content, o => o.MapFrom(m => m.Content))
                .ForMember(x => x.QuestionGroupId, o => o.MapFrom(m => m.QuestionGroupId))
                .ForMember(x => x.QuestionId, o => o.MapFrom(m => m.QuestionId))
                .ForMember(x => x.CreatedBy, o => o.MapFrom(m => m.CreatedBy))
                .ForMember(x => x.CreatedDate, o => o.MapFrom(m => m.CreatedDate))
                .ForMember(x => x.ModifiedBy, o => o.MapFrom(m => m.ModifiedBy))
                .ForMember(x => x.ModifiedDate, o => o.MapFrom(m => m.ModifiedDate));

            Mapper.CreateMap<QuestionGroupItem, QuestionGroupItemViewModel>()
                .ForMember(x => x.Id, o => o.MapFrom(m => m.Id))
                .ForMember(x => x.Name, o => o.MapFrom(m => m.Name))
                .ForMember(x => x.Image, o => o.MapFrom(m => m.Image))
                .ForMember(x => x.TotalQuestion, o => o.MapFrom(m => m.TotalQuestion))
                .ForMember(x => x.Likes, o => o.MapFrom(m => m.Likes))
                .ForMember(x => x.Dislikes, o => o.MapFrom(m => m.Dislikes))
                .ForMember(x => x.Comments, o => o.MapFrom(m => m.Comments));

            Mapper.CreateMap<Like, LikeViewModel>()
                .ForMember(x => x.Id, o => o.MapFrom(m => m.Id))
                .ForMember(x => x.IsDislike, o => o.MapFrom(m => m.IsDislike))
                .ForMember(x => x.QuestionGroupId, o => o.MapFrom(m => m.QuestionGroupId))
                .ForMember(x => x.QuestionId, o => o.MapFrom(m => m.QuestionId))
                .ForMember(x => x.CreatedBy, o => o.MapFrom(m => m.CreatedBy))
                .ForMember(x => x.CreatedDate, o => o.MapFrom(m => m.CreatedDate))
                .ForMember(x => x.ModifiedBy, o => o.MapFrom(m => m.ModifiedBy))
                .ForMember(x => x.ModifiedDate, o => o.MapFrom(m => m.ModifiedDate));
        }
    }
}